package pack0812;

import java.util.Scanner;

public class Work5 {
    public static void main(String[] args) {
        //5：输入数组，最大的与第一个元素交换，最小的与最后一个元素交换，输出数组。
        /*Scanner in = new Scanner(System.in);
        int[] array = new int[10];
        for(int i = 0; i<10; i++){
            System.out.print("请输入一个数字：");
            int a = in.nextInt();
            array[i] = a;
        }*/
        int[] array = {28,56,33,65,28,18,21,24,54,};
        for(int j = 0; j<array.length-1; j++){
            if(array[j+1]>array[j]){
                int a = array[j];
                array[j] = array[j+1];
                array[j+1] = a;
            }
        }

        for(int j = array.length-2; j>=0; j--){
            if(array[j+1]>array[j]){
                int a = array[j];
                array[j] = array[j+1];
                array[j+1] = a;
            }
        }
        for(int i = 0; i<array.length; i++){
            System.out.print(array[i]+"\t");
        }
    }
}
